<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // break方法
        // var water = 15
        // for (var i = 1; i <= 100; i++) {
        //     water += 5
        //     if (water >= 50) {
        //         console.log('小和尚要挑' + i + '次水才可以把水缸挑满')
        //         break
        //     }
        // }

        // do...while 方法
        var i = 0
        // var water = 15
        // do {
        //     i += 1
        //     water += 5
        // } while (water < 50)
        // console.log('小和尚要挑' + i + '次水才可以把水缸挑满')


        // for方法
        for (var water = 15; water < 50; water += 5) {
            i += 1
        }
        console.log('小和尚要挑' + i + '次水才可以把水缸挑满')
    </script>
</body>

</html>